﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SharingCenter.Web.Classes.enums;

namespace SharingCenter.Web.Classes.Scores
{
    public class ScoreOperations
    {
        public static Sc_SharedScore AddScore(EntityType contextType, Guid contextId, int score, Guid giver, Guid taker, string comment)
        {
            Sc_SharedScore dbitem = new Sc_SharedScore();
            dbitem.Comment = comment;
            dbitem.ContextEntityType = contextType;
            dbitem.ScoreDate = DateTime.Now;
            dbitem.ScoreGiverUserId = giver;
            dbitem.ScoreTakerUserId = taker;
            dbitem.Score = score;
            dbitem.ContextId = contextId;
            dbitem.ScoreId = Guid.NewGuid();
            scDataContext.Instance.Sc_SharedScores.InsertOnSubmit(dbitem);
            scDataContext.Instance.SubmitChanges();
            return dbitem;
        }
    }
}
